<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib  uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@taglib  uri="http://www.jicresoft.com/oa/functions" prefix="p"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="css/background.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/table.js"></script>
<link href="css/table.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/openwindow.js"></script>
<script type="text/javascript">
function bookmarkAdd(){
		var url="bookMarkInit.action?status=signature";
	    openWindow(url,600,420);
		}
		
function signatureUpdate(id){
		var url="getSignatureById.action?markId="+id;
	    openWindow(url,600,420);
		}
function deleteMark(){
	var arry="";
	var count=0;
	var checks=$("#tabllist").find("input[name=\"ids\"]");
	for(var i=0;i<checks.length;i++){
		if(checks[i].checked){
			if(arry==''){
			arry+="ids="+checks[i].value;
			}else{
			arry+="&ids="+checks[i].value;
			}
			count++;
		}
	}
	
	if(count==0){
		alert("请选择要删除的数据！");
		return;
	}
	if(confirm("确定要删除？")){
		$.post("deleteSignature.action",arry,function(data){
			if(data=="success"){
				alert("删除数据成功！");
				var currentPage=$("#currentPage").val();
				page(currentPage);
			}else{
				alert("删除数据失败！");
			}
		});
	}
}

	function clearall(){
		$("#name").val("");
		document.signatureForm.submit();
	}
	
	function page(currentPage){
		$("#pageId").val($.trim(currentPage));
		document.pageForm.submit();
	}
	
	function updatePsw(id){
		var currentPage=$("#currentPage").val();
		var url="getSignatureObj.action?markId="+id+"&currentPage="+currentPage;
		  openWindow(url,500,320);
	}
</script>
</head>
<body>
<div class="topdiv">
			<form action="signatureManger.action" name="signatureForm" method="post">
				<div>
					签章名称：<input type="text" id="name" name="name" value="${name}" />
				</div>
				<table align="right">
				 <tr>
					<td>
						<input class="button_04" type="submit" value="立即查找" />
				 		<input align="right"  class="button_02" type="button" onclick="clearall()" value="清除" />
					</td>
				 </tr>
				</table>
			</form>
		</div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tbody>
  <tr>
    <td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
    <td style="background: url('image/wsoa_window_002.gif');"><table border="0" cellpadding="0" cellspacing="0">
      <tbody><tr>
        <td align="center" style="background: url('image/wsoa_window_002.gif');" width="10"><img src="image/center_19.gif"></td>
        <td align="center" style="background: url('image/wsoa_window_002.gif');"></td>
        <td>系统管理 &gt; 模板管理 &gt; 签章管理</td>
        </tr>
    </tbody>
    </table></td>
    <td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
  </tr>
  <tr>
    <td style="background: url('image/wsoa_window_010.gif');"  width="1">&nbsp;</td>
    <td>
    <table class="intable">
		<tr>
			<td>
				<input class="button_02" onclick="bookmarkAdd()" type="button" value="添加"/>
			</td>
			<td>
				<input class="button_02" onclick="deleteMark()" type="button"  value="删除"/>
			</td>
		</tr>
	</table>
<table  id="tabllist" class="righ_list" frame="box" cellspacing="1" cellpadding="0" width="100%"  border="0">
	<tr class="reigh_list2">
		<th  width="5%"><input id="all" type="checkbox" onclick="checkAll()" /></th>
		<th>签章名称</th>
		<th width="10%">签章类型</th>
		<th width="6%">排序</th>
		<th width="10%">创建人</th>
		<th width="18%">创建时间</th>
		<th width="8%">操作</th>
	</tr>
	<c:if test="${empty signList}">
				<tr id="row">
					<td colspan="7" align="left">
						没有相关的记录！
					</td>
				</tr>
	</c:if>
	<c:forEach items="${signList}" var="sign">
	<tr id="row" onmouseover="overStyle(this)" onmouseout="outStyle(this)">
		<td align="center">
		<c:if test="${p:hasPermission(sign.userId,sessionScope.userInfo.id)}">
		<input value="${sign.signatureid}" name="ids" type="checkbox" onclick="checkodd()"/>
		</c:if>
		</td>
		<td align="left">${sign.markname}</td>
		<td align="left">${sign.marktype}</td>
		<td align="left">${sign.px}</td>
		<td align="left">${sign.username}</td>
		<td align="left"><fmt:formatDate value="${sign.markdate}" type="both"/></td>
		<td align="center">
		<c:if test="${p:hasPermission(sign.userId,sessionScope.userInfo.id)}">
		<img alt="修改" onclick="signatureUpdate('${sign.signatureid}')" src="image/operate_update.gif" style="cursor: pointer">
		&nbsp;<img alt="密码修改" onclick="updatePsw('${sign.signatureid}')" src="image/operate_psw.gif" style="cursor: pointer">
	 	</c:if>
	 </td>
	</tr>
	</c:forEach>
</table>
</td>
<td style="background: url('image/wsoa_window_006.gif');"  width="1">&nbsp;</td></tr>
  <tr>
    <td height="1" width="1"><img src="image/wsoa_window_009.gif" height="16" width="14"></td>
    <td style="background: url('image/wsoa_window_008.gif');" height="1"></td>
    <td height="1" width="1"><img src="image/wsoa_window_007.gif" height="16" width="12"></td>
  </tr>
</tbody>
</table>
<div class="pageDiv">
<form action="signatureManger.action" method="post" name="pageForm">
<input type="hidden" name="name" value="${name}">
<input type="hidden" id="pageId" name="currentPage">
<%@include file="../page/page.jsp"%>
</form>
</div>
</body>
</html>